package com.dgut.demo.controller;

import com.dgut.demo.bean.LogsMessage;
import com.dgut.demo.service.LogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther 虎
 * @Data 2021/2/19 20:11
 * @Version 1.0
 */
@RestController
public class LogsController {
    @Autowired
    private LogsService logsService;

    @GetMapping("/getAllLogsMessage")
    public List<LogsMessage> getAllLogsMessage(){
        return logsService.getAllLogsMessage();
    }

    @PostMapping("/addOneLogsMessage")
    public int addOneLogsMessage(String actions,String userId){
        return logsService.addOneLogsMessage(actions,userId);
    }

    @GetMapping("/getLogsMessageByName")
    public List<LogsMessage> getLogsMessageByName(String peoples){
        return logsService.getLogsMessageByName(peoples);
    }

    @GetMapping("/getLogsMessageByTime")
    public List<LogsMessage> getLogsMessageByTime(String begindate,String enddate){
        return logsService.getLogsMessageByTime(begindate,enddate);
    }

    @GetMapping("/getLogsMessageByNameAndTime")
    public List<LogsMessage> getLogsMessageByNameAndTime(String peoples,String begindate,String enddate){
        return logsService.getLogsMessageByNameAndTime(peoples,begindate,enddate);
    }

}
